<template>
  <view>
    <view class="cu-bar bg-white margin-top-xs">
      <view class="action sub-title">
        <text class="text-xl text-bold text-shadow text-custom">订单列表</text>
        <text class="text-ABC text-custom">ORDER</text>
      </view>
      <view class="action" @click="goVerify">
        <text class="text-lg text-shadow text-custom">核销</text>
      </view>
    </view>
    <view
        class="cu-list menu  shadow-shop bg-white text-black  sm-border">
      <order-one-stastic-list v-for="(osl,index) in orderStasticList"
                              :orderKey="osl.orderKey"
                              :orderLabel="osl.orderLabel"
                              :orderCode="osl.orderCode"
                              :orderCount="osl.orderCount"
      ></order-one-stastic-list>
    </view>
  </view>
</template>

<script setup lang="ts">
import {onLoad, onReady, onShow} from '@dcloudio/uni-app';
import {ref, onMounted, reactive, toRaw, computed} from 'vue';
import OrderOneStasticList from "../../components/OrderOneStasticList.vue";
import {useStore} from "@/common/store";
import {findOwnerOrderStastic} from '@/common/api/order'

const store = useStore();
const token = computed(() => store.token)
const userId = computed(() => store.userId)
const orderStasticList = ref([]);

const initOrderStastic = () => {
  findOwnerOrderStastic(userId.value || 0).then(res => {
    orderStasticList.value = res.data;
  })
}

// 核销订单
const goVerify = () => {
  uni.navigateTo({
    url: `/pages/order/VerifyOrderList?orderKey=1`
  })
}

onShow(()=>{
  initOrderStastic();
})

</script>

<style lang="scss" scoped>
//.page {
//  height: 50Vh;
//  width: 100vw;
//}
</style>
